import React from 'react';
import { Select, Form } from 'antd';

export default class EditableCell extends React.PureComponent {
  state = {};

  render() {
    const value = this.props.cellData;
    if (value) {
      return (
        <Form.Item
          hasFeedback
          validateStatus={this.props.validateStatus}
          style={{ width: '100%', padding: 0, margin: 0 }}
        >
          <Select style={{ width: '90%' }} value={value} {...this.props}>
            {this.props.children}
          </Select>
        </Form.Item>
      );
    }
    return (
      <Form.Item
        hasFeedback
        validateStatus={this.props.validateStatus}
        style={{ width: '100%', padding: 0, margin: 0 }}
      >
        <Select style={{ width: '100%' }} {...this.props}>
          {this.props.children}
        </Select>
      </Form.Item>
    );
  }
}
